package com.turing.post.cardmanagement.util;

import javax.ejb.Local;
import javax.ejb.Remote;

import com.turing.post.util.PCPSApplicationException;

@Remote
@Local
public interface AppCardOperationBusiness {
	/**
	 * 产生应用发行前卡片检查APDU指令列表
	 * 
	 * @param am
	 * @return
	 * @throws PCPSApplicationException
	 */
	public ApduExecuteObj generateAppPreIssueApdu(AppManagement am)
			throws PCPSApplicationException;

	/**
	 * 解析发行前卡片检查APDU结果,成功后返回对象
	 * 
	 * @param am
	 * @param aeo
	 * @param cardSeqNo
	 * @return
	 * @throws PCPSApplicationException
	 */
	public AppZoneInf parseAppPreIssueApdu(AppManagement am,
			ApduExecuteObj aeo, String cardSeqNo)
			throws PCPSApplicationException;

	/**
	 * 产生应用发行APDU指令列表
	 * 
	 * @param am
	 * @param azi
	 * @return
	 * @throws PCPSApplicationException
	 */
	public ApduExecuteObj generateAppIssueApdu(AppManagement am, AppZoneInf azi)
			throws PCPSApplicationException;

	/**
	 * 解析应用发行APDU结果
	 * 
	 * @param am
	 * @param aeo
	 * @throws PCPSApplicationException
	 */
	public void parseAppIssueApduResult(AppManagement am, ApduExecuteObj aeo)
			throws PCPSApplicationException;

	/**
	 * 产生读应用区域的APDU指令列表
	 */
	public ApduExecuteObj generateReadAppZoneApdu(AppManagement am)
			throws PCPSApplicationException;

	/**
	 * 将APDU指令的结果进行解析,返回本应用特定的对象
	 * 
	 * @param am
	 * @return
	 */
	public AppZoneInf parseAppZoneObject(AppManagement am, ApduExecuteObj aeo)
			throws PCPSApplicationException;

	/**
	 * 将指定应用特定的对象进行HTML渲染,以驱动客户端展现
	 * 
	 * @param am
	 * @param appObj
	 * @return
	 * @throws PCPSApplicationException
	 */
	public String renderAppZoneObject(AppManagement am, AppZoneInf appObj)
			throws PCPSApplicationException;

	/**
	 * 产生圈存初始化APDU指令列表
	 * 
	 * @param am
	 * @param appObj
	 *            圈存前读出的卡内应用对象
	 * @param loadSeqNo
	 * @return
	 */
	public ApduExecuteObj generateLoadInitApdu(AppManagement am,
			AppZoneInf appObj, String loadSeqNo)
			throws PCPSApplicationException;

	/**
	 * 解析圈存初始化结果,根据其结果产生圈存APDU指令列表
	 * 
	 * @param am
	 * @param aeo
	 * @return
	 */
	public ApduExecuteObj generateLoadApdu(AppManagement am, ApduExecuteObj aeo)
			throws PCPSApplicationException;

	/**
	 * 解析圈存结果
	 * 
	 * @param am
	 * @param aeo
	 * @return
	 */
	public void parseLoadApduResult(AppManagement am, ApduExecuteObj aeo)
			throws PCPSApplicationException;
}
